package svgedit.gui.actions;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.util.ArrayList;

import javax.swing.AbstractAction;

import svgedit.gui.Circle;
import svgedit.gui.Frame;
import svgedit.gui.Line;
import svgedit.gui.Rect;
import svgedit.gui.View;

public class SelectAllAction extends AbstractAction{
	
	public static ArrayList<Circle> circles = View.getCircles();
	public static ArrayList<Line> lines = View.getLines();
	public static ArrayList<Rect> rects = View.getRects();
	public static ArrayList<Color> colors = View.getColors();
	private Frame frame;

    /** Create this action for the given frame */
    public SelectAllAction(Frame frame) {
        super("Select All");
        this.frame = frame;
    }

	@Override
	public void actionPerformed(ActionEvent arg0) 
	{
		if(!circles.isEmpty()) {
			for(Circle circle : circles) {
					circle.setIsSelected(true);
					frame.repaint();
			}

		}
		if(!rects.isEmpty()) {
			for(Rect rect : rects) {
					rect.setIsSelected(true);
					frame.repaint();
			}
		}
		if(!lines.isEmpty()) {
			for(Line line : lines) {
					line.setIsSelected(true);
					frame.repaint();
			}
		}	
		
	}

}
